package com.ocom.webapi.controller;


import com.ocom.common.constant.WebApiServiceUrl;
import com.ocom.common.request.payconfig.SaveDishesPlacesRequest;
import com.ocom.common.request.payconfig.food.ComMerchRequest;
import com.ocom.common.request.payconfig.food.ComPointRequest;
import com.ocom.common.request.payconfig.food.DishesPlaceListRequest;
import com.ocom.common.resp.Result;
import com.ocom.webapi.feign.PayConfigClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@PreAuthorize("@pms.hasRole('ROLE_WEB')" )
public class DishesPointController {

    @Autowired
    PayConfigClientService payConfigClientService;

    //6.9.1获取餐厅消费点列表（DishesPoint/pointList）
    @PostMapping(WebApiServiceUrl.Url_DishesPointPointList)
    public Result pointList(@RequestBody ComMerchRequest request){
        return payConfigClientService.getPlanPointList(request);
    }
    //6.9.2获取菜品排放计划列表（DishesPoint/dishesPlacePlan）
    @PostMapping(WebApiServiceUrl.Url_DishesPointDishesPlacePlan)
    public Result dishesPlacePlan(@RequestBody ComPointRequest request){
        return payConfigClientService.getPlacePlanList(request);
    }
    //6.9.3获取菜品摆放方案（DishesPoint/dishesPlaceList）
    @PostMapping(WebApiServiceUrl.Url_DishesPointDishesPlaceList)
    public Result dishesPlaceList(@RequestBody DishesPlaceListRequest request){
        return payConfigClientService.getDishesPlaceList(request);
    }
    //6.9.4获取餐厅下级消费点列表（DishesPoint/subPointList）
    @PostMapping(WebApiServiceUrl.Url_DishesPointSubPointList)
    public Result subPointList(@RequestBody ComPointRequest request){
        return payConfigClientService.getSubPointList(request);
    }
    //6.9.5设置菜品摆放位置（DishesPoint/setDishesPlaces）
    @PostMapping(WebApiServiceUrl.Url_DishesPointSetDishesPlaces)
    public Result setDishesPlaces(@RequestBody SaveDishesPlacesRequest request){
        return payConfigClientService.saveDishesPlaces(request);
    }
}
